export function isObject(obj: any): boolean {
  return typeof obj === 'object' && obj !== null;
}

export const RAW = Symbol('raw');
export const ITERATE_KEY = Symbol('iterate')

export enum TrackOpTypes{
  GET = 'get',
  HAS = 'has',
  ITERATE = 'iterate'
}

export enum TriggerOpTypes{
  SET = 'set',
  ADD = 'add',
  DELETE = 'delete',
  // CLEAR = 'clear'
}

export interface Target {
  [RAW]?: any
}

export function toRaw<T>(observed: T): T { 
  const raw = observed && (observed as Target)[RAW];
  return raw ? toRaw(raw) : observed;
}

export function hasChanged(oldVal: any, newVal: any) {
  return !Object.is(oldVal, newVal);
}